home *** CD-ROM | disk | FTP | other *** search
/ Interactive Media Design Review 1999 / Interactive Media Design Review 1999.iso / pc / Demos / Herois / Codigo.Cst / 00032_Script_Universo 2 FrameScript < prev    next >
Text File  |  1999-03-19  |  4KB  |  116 lines

  1. on enterFrame
  2.   global gUniversoPicts
  3.   put the number of member "Universo Picts" into gUniversoPicts
  4.   repeat with i = 1 to 12 
  5.     puppetSprite i,true
  6.   end repeat
  7.   
  8.   
  9.   global gUniversoPosicaoX,gUniversoPosicaoY
  10.   put 0 into gUniversoPosicaoX
  11.   put 0 into gUniversoPosicaoY
  12.   moveUniverso gUniversoPosicaoX,gUniversoPosicaoY
  13.   
  14.   repeat with i=1 to 12
  15.     set the foreColor of sprite i to ¼
  16.       (the backColor of member "FundoPreto")
  17.     set the backColor of sprite i to ¼
  18.       (the backColor of member "FundoBranco")
  19.     set the visible of sprite i to true
  20.   end repeat
  21.   updateStage
  22.   
  23. end
  24.  
  25. on idle
  26.   -- gPals, gArqs e gRefs sao referencias ao
  27.   -- banco de dados de palavras, arquivos e referencias
  28.   global gEntrada, gPals, gArqs, gRefs
  29.   global gPalIndexes, gArqIndexes, gPalSelect
  30.   global gBuscando, gTamanhoLista
  31.   
  32.   -- Testa se a pessoa digitou alguma coisa no campo
  33.   -- "Busca"
  34.   if (gEntrada <> the text of field "Busca") then
  35.     
  36.     -- Limpa listas
  37.     set the text of field "Lista Palavras" to ""
  38.     set the text of field "Lista Arquivos" to ""
  39.     put psGeraTitulos(1,20) into lista
  40.     set the text of member "Paginas Selecionadas" to lista
  41.     put "" into lista
  42.     put [] into gPalIndexes
  43.     put [] into gArqIndexes
  44.     put -1 into gPalSelect
  45.     put false into gBuscando
  46.     put 0 into gTamanhoLista
  47.     
  48.     
  49.     -- Guarda o que a pessoa digitou
  50.     put the text of field "Busca" into gEntrada
  51.     
  52.     -- Se a pessoa nao digitou nada, volta com as
  53.     -- listas vazias
  54.     if (gEntrada = "") then return
  55.     
  56.     -- Prepara busca na base de dados
  57.     mSetCriteria(gPals, "canonica", "starts", canoniza(gEntrada))
  58.     mSelect(gPals)
  59.     
  60.     -- Se ha' mais que 20 registros para ler, prepara 
  61.     -- para continuar a ler nos proximos "idle"
  62.     put mSelectCount(gPals) into counter
  63.     if counter > 20 then 
  64.       put 20 into counter
  65.       put true into gBuscando
  66.     end if
  67.     
  68.     -- Le ate' os primeiros 20 da lista
  69.     repeat while counter > 0 
  70.       if (lista <> "") then put RETURN after lista
  71.       put mGetField(gPals,"palavra") after lista
  72.       add gPalIndexes, mGetField(gPals,"palNum")
  73.       mGoNext(gPals)
  74.       put counter - 1 into counter
  75.       put gTamanhoLista + 1 into gTamanhoLista
  76.     end repeat
  77.     
  78.     -- Reseta lista de palavras
  79.     set the text of field "Lista Palavras" to lista
  80.     set the foreColor of field "Lista Palavras" to ¼
  81.       (the backColor of member "FundoPreto")
  82.     
  83.     -- Atualiza "Stage"
  84.     updateStage
  85.     
  86.     -- Se continua o mesmo inicio de palavra em "Busca"
  87.     -- Verifica se ha' mais registros para ler
  88.   else if gBuscando then
  89.     
  90.     -- Verifica tamanho da memoria
  91.     global myMemSize
  92.     if myMemSize <= 8192*1024 or ¼
  93.        (myMemSize <= 16384*1024 and gTamanhoLista > 100) then
  94.       put false into gBuscando
  95.       return
  96.     end if
  97.     
  98.     
  99.     -- Le 3 registros de cada vez
  100.     put 3 into counter
  101.     put 0 into ret
  102.     
  103.     -- Le 3 registros ou ate chegar no fim
  104.     put the text of field "Lista Palavras" into lista
  105.     repeat while counter > 0 and ret >= 0
  106.       put RETURN & mGetField(gPals,"palavra") after lista 
  107.       add gPalIndexes, mGetField(gPals,"palNum")
  108.       set ret to mGoNext(gPals)
  109.       put counter - 1 into counter      
  110.       put 1 + gTamanhoLista into gTamanhoLista
  111.     end repeat
  112.     set the text of field "Lista Palavras" to lista
  113.     
  114.     if ret < 0 then put false into gBuscando
  115.   end if
  116. end